# Maintainer: Lubosz Sarnecki <lubosz@gmail.com>

_realname=clutter-gst
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.0.27
pkgrel=1
pkgdesc="A GStreamer integration library for Clutter (mingw-w64)"
arch=('any')
url="https://blogs.gnome.org/clutter"
license=("LGPL")
makedepends=('automake' 'libtool' 'intltool' 'itstool' 'gtk-doc' 'gnome-doc-utils' 'yelp-tools')
depends=("${MINGW_PACKAGE_PREFIX}-gobject-introspection"
         "${MINGW_PACKAGE_PREFIX}-clutter"
         "${MINGW_PACKAGE_PREFIX}-gstreamer"
         "${MINGW_PACKAGE_PREFIX}-gst-plugins-base")
options=(!libtool strip staticlibs)
source=(https://download.gnome.org/sources/${_realname}/${pkgver:0:3}/${_realname}-${pkgver}.tar.xz
        "0002-install-gtk-doc.patch")
sha256sums=('fe69bd6c659d24ab30da3f091eb91cd1970026d431179b0724f13791e8ad9f9d'
            'cc980fa88c919b408534a05dafdd1af9f6e9fd321a25633a490935a330cc39aa')

prepare() {
  cd ${_realname}-${pkgver}

  patch -b -V simple -p1 -i ${srcdir}/0002-install-gtk-doc.patch

  autoreconf -fvi
}

build() {
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir ${srcdir}/build-${MINGW_CHOST}
  cd "${srcdir}/build-${MINGW_CHOST}"

  mkdir -p doc/reference/html
  cp -rf ../${_realname}-${pkgver}/doc/reference/html/* doc/reference/html

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --disable-static \
    --enable-shared \
    --enable-silent-rules \
    --disable-gtk-doc

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make -j1 DESTDIR="${pkgdir}" install

  rm -f ${pkgdir}${MINGW_PREFIX}/lib/gstreamer*/*.a

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
